package com.tbit.main.service.impl;

import com.tbit.main.constant.DaoParamConstant;
import com.tbit.main.dao.stat.AccountDataMonthStaDao;
import com.tbit.main.pojo.AccountDataDaySta;
import com.tbit.main.pojo.AccountDataMonthSta;
import com.tbit.main.service.AccountDataMonthStaService;
import com.tbit.main.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author LMY
 * @create 2022-03-30 17:06
 */
@Service("accountDataMonthStaService")
public class AccountDataMonthStaServiceImpl implements AccountDataMonthStaService {

    @Autowired
    private AccountDataMonthStaDao brandDataMonthStaDao;

    @Override
    public List<AccountDataMonthSta> getByBrandIdAndTime(Integer brandId, String startTime, String endTime) {
        Map<String, Object> map = new HashMap<>();
        map.put("brandId", brandId);
        map.put(DaoParamConstant.startTime, startTime);
        map.put(DaoParamConstant.endTime, endTime);
        return brandDataMonthStaDao.getByBrandIdAndTime(map);
    }

    @Override
    public List<AccountDataDaySta> getByAccountIdAndTime(List<Integer> accountIds, String startTime, String endTime) {
        Map<String, Object> map = new HashMap<>();
        map.put(DaoParamConstant.accountId, StringUtil.getListString(accountIds));
        map.put(DaoParamConstant.startTime, startTime);
        map.put(DaoParamConstant.endTime, endTime);
        return brandDataMonthStaDao.getByAccountIdAndTime(map);
    }
}
